﻿<UserControl
    x:Class="DvachBrowser3.Views.Partial.BannerView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DvachBrowser3.Views.Partial"
    xmlns:local2="using:DvachBrowser3"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="100"
    d:DesignWidth="300">
    <UserControl.Resources>
        <local2:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
    </UserControl.Resources>
    
    <Grid Tapped="BannerElement_OnTapped">
        <Border Margin="0" Padding="0" Background="{ThemeResource SystemControlBackgroundChromeMediumBrush}" Height="{x:Bind ViewModel.Height, Mode=OneWay}" Width="{x:Bind ViewModel.Width, Mode=OneWay}">
            <Grid>
                <Image x:Name="BannerImage" Visibility="Collapsed" Height="{x:Bind ViewModel.Height, Mode=OneWay}" Width="{x:Bind ViewModel.Width, Mode=OneWay}"
                   Stretch="UniformToFill"/>
                <Image x:Name="GifBannerImage" Visibility="Collapsed" Height="{x:Bind ViewModel.Height, Mode=OneWay}" Width="{x:Bind ViewModel.Width, Mode=OneWay}"
                   Stretch="UniformToFill"/>
                <ProgressRing IsActive="True" Height="32" Width="32" Foreground="{ThemeResource SystemControlForegroundAccentBrush}" Visibility="{x:Bind ViewModel.IsLoading, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=false, Mode=OneWay}"></ProgressRing>
                <SymbolIcon x:Name="ErrorSymbol" Symbol="Clear" Foreground="Red" Visibility="{x:Bind ViewModel.IsError, Converter={StaticResource BoolToVisibilityConverter}, ConverterParameter=false, Mode=OneWay}" Height="48" Width="48" Tapped="ErrorSymbol_OnTapped" />
            </Grid>
        </Border>
    </Grid>
</UserControl>
